package 线程安全.多线程;

import java.io.IOException;
import java.net.Inet4Address;
import java.net.Socket;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket client = new Socket("127.0.0.1", 12021);
        System.out.println("客户端启动成功！");
        Scanner sc = new Scanner(System.in);
        SendMsg sendMsg = new SendMsg(client);
        new Thread(sendMsg).start();
        new Thread(new ReadMsg(client)).start();
        while (true) {
            System.out.println("请输入你要发送的消息！");
            String msg = sc.nextLine();
            sendMsg.addMsg(msg);
        }
    }
}
